import { url } from '@/config';
import crypto from '@/utils/crypto'
import request from '../axios';
export const getList = (params) => {
  return request({
    url: url + '/report/reportVisualDb/getPageSet',
    // url: url + '/report/reportVisualRecord/getPageSet',
    method: 'get',
    params: params
  })
}

export const getDetail = (uuid) => {
  return request({
    url: url + '/report/reportVisualDb/detail',
    method: 'get',
    params: {
      uuid
    }
  })
}

export const remove = (uuid) => {
  return request({
    url: url + '/report/reportVisualDb/deleteByPrimaryKey',
    method: 'post',
    params: {
      uuid,
    }
  })
}

export const add = (row) => {
  return request({
    url: url + '/report/reportVisualDb/save',
    method: 'post',
    data: row
  })
}

export const update = (row) => {
  return request({
    url: url + '/report/reportVisualDb/update',
    method: 'post',
    data: row
  })
}
export const dynamicSql = (data) => {
  return request({
    url: url + '/report/reportVisualDb/dynamic-query',
    method: 'post',
    headers: {
      'Content-Type': 'application/json',
      'data': data
    },
    data: data
  })
}
export const dbTest = (data) => {
  return request({
    url: url + '/report/reportVisualDb/dbTest',
    method: 'post',
    headers: {
      'Content-Type': 'application/json',
      'data': crypto.encrypt(JSON.stringify(data))
    },
    data: data
    // data: crypto.encrypt(JSON.stringify(data))
  })
}
